#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

void* my_memcpy(void* dest, const void* sour,size_t num) {
	void* start = dest;
	while (num--) {
		*((char*)dest) = *((char*)sour);
		dest = (char*)dest + 1;
		sour = (char*)sour + 1;
	}
	return start;
}

void* my_memmove(void* dest, const void* sour, size_t num) {
	void* start = dest;
	if (dest < sour) {
		while (num--) {
			*((char*)dest) = *((char*)sour);
			dest = (char*)dest + 1;
			sour = (char*)sour + 1;
		}
	}
	else {
		while (num--) {
			*((char*)dest + num) = *((char*)sour+num);
		}
	}
	return start;
}

int main() {
	char str1[20] = { 0 };
	char str2[10] = { 0 };
	gets(str1);
	gets(str2);
	printf("%s\n", (char*)my_memcpy(str1, str2, 6));

	int arr1[] = { 1,2,3,4,5,6,7,8 };
	int arr2[] = { 9,10,11,12 };
	my_memmove(arr1+3, arr1 , 12);
	for (int i = 0; i < 8; i++) {
		printf("%d ", arr1[i]);
	}
	return  0;
}